using System;
using System.Data.Entity.ModelConfiguration;
using System.Data.Common;
using System.Data.Entity;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;
using DomainLayer.Data.Entities;

namespace Infrastructure.Data.Mapping
{
	public class ProvinceMap : EntityTypeConfiguration<Province>
	{
		public ProvinceMap()
		{
			// Primary Key
			this.HasKey(t => t.ProvinceID);

			// Properties
			this.Property(t => t.ProvinceID)
				.IsRequired()
				.HasMaxLength(10);
				
			this.Property(t => t.ProvinceName)
				.IsRequired()
				.HasMaxLength(50);
				
			this.Property(t => t.DistrictID)
				.HasMaxLength(10);
				
			// Table & Column Mappings
			this.ToTable("Province");
			this.Property(t => t.ProvinceID).HasColumnName("ProvinceID");
			this.Property(t => t.ProvinceName).HasColumnName("ProvinceName");
			this.Property(t => t.DistrictID).HasColumnName("DistrictID");
			this.Property(t => t.IsDeleted).HasColumnName("IsDeleted");
		}
	}
}

